// wgltransfo.hpp
//

#ifndef _WGLTRANSFO_HPP
#define _WGLTRANSFO_HPP

#include "wgl/wglbase.hpp"

#include "glm/vec3.hpp"
#include "glm/mat4x4.hpp"

namespace wgl
{
  // Transfo
  //
  class Transfo
  {
  public:
    Transfo ();
    Transfo ( glm::vec3 position,
              glm::vec3 rotation,
              glm::vec3 scale );
    
    const glm::mat4 &get_matrix ();
    const glm::mat4 &get_inverse ();
    const glm::vec3 &get_position() const { return v_position; }
    const glm::vec3 &get_rotation () const { return v_rotation; }
    
    void set_position ( glm::vec3 position );
    void set_rotation ( glm::vec3 rotation );
    void set_scale ( glm::vec3 scale );
    void set_scale ( float s ) { set_scale(glm::vec3{s, s, s}); } 

    void move ( glm::vec3 position );
    void rotate ( glm::vec3 rotation );
    void scale ( glm::vec3 scale );

  private:
    glm::mat4 m_transfo{};
    glm::mat4 m_inverse{};
    
    glm::vec3 v_position{0.f};
    glm::vec3 v_rotation{0.f};
    glm::vec3 v_scale{1.f, 1.f, 1.f};

    bool transfo_dirty{true};
    bool inv_dirty{true};
  };
}

#endif
